#!/bin/bash

# 检查是否为 root 用户
if [ "$EUID" -ne 0 ]; then 
    echo "Please run as root"
    exit 1
fi

# 检测系统类型
if [ -f /etc/debian_version ]; then
    # Debian/Ubuntu
    apt-get update
    apt-get install -y \
        build-essential \
        cmake \
        qt5-default \
        qtbase5-dev \
        qttools5-dev \
        qttools5-dev-tools
        
elif [ -f /etc/redhat-release ]; then
    # CentOS/RHEL
    yum groupinstall -y "Development Tools"
    yum install -y \
        cmake3 \
        qt5-qtbase-devel \
        qt5-qttools-devel
        
else
    echo "Unsupported system"
    exit 1
fi

echo "Dependencies installed successfully" 